<?php
namespace App\Api\V1\Models;

use Illuminate\Database\Eloquent\Model;

class Navigation extends Model
{
	protected $table = 'Navigation';
	public $timestamps = false;

    /*
    添加一条导航数据
    */
    public function addNavigationItem()
    {
        $ds = [
        	"name"=>'团购',
        	"url"=>'//careyshop.com',
        	"target"=>'_blank',
        	"sort"=>'50',
        	"status"=>'1',
        ];

        $this->name = $ds['name'];
        $this->url = $ds['url'];
        $this->target = $ds['target'];
        $this->sort = $ds['sort'];
        $this->status = $ds['status'];

        if ($this->save()) {
        	return $this->toArray();
        }
        return false;
    }

    /*
    删除一条记录
    */

    public function delNavigationList()
    {
    	return $this->where('navigation_id','1')->delete();
    }

    /*
    获取导航列表
    */

    public function getNavigationList()
    {
    	return $this->get()->toArray();
    }
}
